import cv2
import os

path = "style" # 图片存放的路径
new_path = "new_style"

for dirpath, dirs, files in os.walk(path):
    for file in files:
        imgpath = os.path.join(dirpath, file)
        new_img_path = os.path.join(new_path, file)
        print("compressing ..."+ imgpath)
        image=cv2.imread(imgpath)
        print(image.shape)
        res = cv2.resize(image, (int(image.shape[0]/2),int(image.shape[1]/2)), interpolation=cv2.INTER_AREA)
        cv2.imwrite(new_img_path, res)
        